import numpy as np
import matplotlib.pyplot as plt

class AppPlot():

	def plotImg(self, inAppList, inTitle, inLabelX, inLabelY, xTickLabels):

		N = 10
		self.womenMeans = inAppList
		self.plotTitle = inTitle
		self.labelX = inLabelX
		self.labelY = inLabelY
		self.xTickLabels = xTickLabels
		menMeans = (20, 35, 30, 35, 27)
		menStd =   (2, 3, 4, 1, 2)

		ind = np.arange(N)  # the x locations for the groups
		width = 0.35       # the width of the bars

		fig = plt.figure()
		ax = fig.add_subplot(111)
		rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd)

		#womenMeans = (25, 32, 34, 20, 25)
		womenStd =   (3, 5, 2, 3, 3)
		rects2 = ax.bar(ind+width, self.womenMeans, width, color='y', yerr=womenStd)

		# add some
		ax.set_ylabel(self.labelY)
		ax.set_xlabel(self.labelX)		
		ax.set_title(self.plotTitle)
		ax.set_xticks(ind+width)
		ax.set_xticklabels(self.xTickLabels)

		ax.legend( (rects1[0], rects2[0]), ('Men', 'Women') )

		def autolabel(rects):
		    # attach some text labels
		    for rect in rects:
		        height = rect.get_height()
		        ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
		                ha='center', va='bottom')

		autolabel(rects1)
		autolabel(rects2)

		plt.show()